import {Injectable, Injector} from '@angular/core';
import {Constant} from '@core/constant';
import {_HttpClient, SettingsService} from '@delon/theme';
import {MyHttpClient} from '../MyHttpClient';

@Injectable()
export class fhListService {
  get cnt(): Constant {
    return this.injector.get(Constant);
  }

  constructor(
    private injector: Injector,
    private http: _HttpClient,
    private myHttp: MyHttpClient,
    public setting: SettingsService,
  ) {
  }

  /**
   * 分页获取商品
   */
  list(): string {
    return `${this.cnt.baseUrl}/rest/sapEkpoFhController/list/` + this.setting.user.username;
  }

  /**
   * 获取发货
   * @param id
   */
  getprodetail(id) {
    return this.http.get(`${this.cnt.baseUrl}/rest/sapEkpoFhController/` + id);
  }
  /**
   * 获取产品
   * @param id
   */
 delprodetail(vbeln1) {
    return this.http.get(`${this.cnt.baseUrl}/rest/sapEkpoFhController/del/` + vbeln1);
  }
  /**
   * 修改发货
   * @param product
   */
  editPro(product) {
    return this.http.put(
      `${this.cnt.baseUrl}/rest/sapEkpoFhController/${product.id}`,
      product,
    );
  }

  delPro(id) {
    return this.http.delete(
      `${this.cnt.baseUrl}/rest/sapEkpoFhController/${id}`
    );
  }




  batchdown(conhead) {
    return this.http.post(`${this.cnt.baseUrl}/rest/sapEkpoFhController/batch/batchdown/${this.setting.user.username}`,
      conhead);
  }
  batchdownbq(conhead ) {
    return this.http.post(`${this.cnt.baseUrl}/rest/sapEkpoFhController/batch/batchdownbq/${this.setting.user.username}`,
      conhead
    );
  }
}
